#pragma once
#include <memory>
#include <string>
#include "tensor.h"
#include "thread_safe_queue.h"

struct GstObjElement;

struct RGBImage {
    size_t width;
    size_t height;
    size_t size;
    uint8_t* data;
    std::shared_ptr<uint8_t> dataPtr;
    RGBImage clone();
};

class GstVideoReader {
   public:
    GstVideoReader();
    ~GstVideoReader();
    void open(const std::string& videoPath);
    void play();
    void stop();
    void loopRun();

   public:
    ThreadSafeQueue<std::shared_ptr<Tensor<unsigned char>>> frameQue_;
    int width_;
    int height_;
    int fps_;
    std::string path_;

   private:
    GstObjElement* gstEle_ = nullptr;
};